{% if storeConfig.mediago_pixel_cfg %}
{% assign megoaa_pixels = storeConfig.mediago_pixel_cfg | strtoarray %}
{% if megoaa_pixels %}
<script type='text/javascript'>
    window._megoaa = window._megoaa || [];
    window._megoaa.push({ type: 'nextjump', link: [location.host]});
    !function (t, f, a, x) {
            if (!document.getElementById(x)) {
                t.async = 1;t.src = a;t.id=x;f.parentNode.insertBefore(t, f);
            }
    }(document.createElement('script'),
    document.getElementsByTagName('script')[0], '//cdn.mediago.io/js/pixel.js', 'pixel_megoaa_script');

    document.addEventListener("DOMContentLoaded",function(){
      var pixels ={{megoaa_pixels| json}};
      function pushMegoaaPixel(name){
        pixels.map(function(pixel){
          window._megoaa.push({ type: 'event', name: name, acid: pixel});
        })

      }
      window['TOP_GLOBAL_CALLBACK_LAYER'].register({
        view_content:function(){
          pushMegoaaPixel("ViewContent")
        },
        search:function(){
          pushMegoaaPixel("Search")
        },
        purchase:function(){
          pushMegoaaPixel("Purchase")
        },
        page_view:function(){
          pushMegoaaPixel("PageView")
        },
        add_to_cart:function(){
          pushMegoaaPixel("AddToCart")
        },
        sign_up:function(){
          pushMegoaaPixel("CompleteRegistration")
        },
        add_payment_information:function(){
          pushMegoaaPixel("AddPaymentInfo")
        },
        begin_checkout:function(){
          pushMegoaaPixel("Checkout")
        }
      })
    }) 
</script>
<noscript>
    <img src='//trace.mediago.io/api/bidder/track/pixel/pageview?tn=f9f2b1ef23fe2759c2cad0953029a94b&acid=29766' width='0' height='0' style='display:none' />
</noscript>
{% endif %}
{% endif %}
